home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / honeytrouble.swf / scripts / frame_13 / DoAction.as
Encoding:
Text File  |  2007-09-27  |  7.2 KB  |  307 lines

  1. function initLevelPara(para)
  2. {
  3.    setGameLevelStart = true;
  4.    tgt_type = para.tgt_type;
  5.    tgt_totalNum = para.tgt_totalNum;
  6.    tgt_speed = para.tgt_speed;
  7.    min_speed = para.min_speed;
  8.    speed_a = para.speed_a;
  9.    speed_a = 4;
  10.    type_num_array = new Array();
  11.    i = 1;
  12.    while(i <= tgt_type)
  13.    {
  14.       type_num_array[i] = 0;
  15.       i++;
  16.    }
  17.    tgt_same_base = para.tgt_same_base;
  18.    tgt_same_change = para.tgt_same_change;
  19.    tgt_same_total = tgt_same_base + random(tgt_same_change);
  20.    tgt_same_num = 0;
  21.    tagTime = para.tagTime;
  22.    superBall_rnd = para.superBall_rnd;
  23.    shooting = false;
  24.    levelTimes = 0;
  25. }
  26. function show_para(_para)
  27. {
  28.    trace("para=new Object()");
  29.    for(name in _para)
  30.    {
  31.       trace("para." + name + "=" + _para[name]);
  32.    }
  33. }
  34. function show_centerPos(pos)
  35. {
  36.    trace("pos=new Object()");
  37.    trace("pos.x=" + pos.x);
  38.    trace("pos.y=" + pos.y);
  39. }
  40. function traceRoad(road)
  41. {
  42.    trace("//------------");
  43.    show_pos(road.road);
  44.    show_para(road.para);
  45.    show_centerPos(road.center_pos);
  46.    trace("//------------");
  47. }
  48. function initMovie()
  49. {
  50.    for(var _loc2_ in tgt_mcs)
  51.    {
  52.       trace(" tgt_mas[it] = " + tgt_mas[_loc2_]);
  53.    }
  54.    trace("---------------init Movie--------------");
  55.    clearAll();
  56.    trace("     ------ Σ║ºτöƒτ¢«τÉâσÆîτ¢«µáçτÉâ -----");
  57.    center_mc.nextBall._visible = true;
  58.    center_mc.nextBall.type = random(tgt_type) + 1;
  59.    center_mc.nextBall.gotoAndStop(center_mc.nextBall.type);
  60.    center_mc.nextBall2._visible = true;
  61.    center_mc.nextBall2.type = random(tgt_type) + 1;
  62.    center_mc.nextBall2.gotoAndStop(center_mc.nextBall2.type);
  63.    trace(center_mc.nextBall2.type + "^^^^^^^^^^^^^^^^^^^^^^^┬ú┬ú┬ú┬ú┬ú┬ú┬ú┬ú" + center_mc.nextBall.type);
  64.    crtNewBall();
  65.    snd_move_in_start();
  66.    crt_new_ball();
  67.    last_ball = firstBall;
  68.    move_listener_mc.onEnterFrame = function()
  69.    {
  70.       if(!game_pause)
  71.       {
  72.          if(Key.isDown(32) and !KEYtemp)
  73.          {
  74.             if(_root.beijingGK.hitTest(_root.beijingGK._xmouse,_root.beijingGK._ymouse,false))
  75.             {
  76.                trace("change Ball");
  77.                _root.cheangballHS();
  78.                KEYtemp = true;
  79.             }
  80.          }
  81.          else if(!Key.isDown(32) and KEYtemp)
  82.          {
  83.             KEYtemp = false;
  84.          }
  85.          tgt_forward();
  86.       }
  87.    };
  88. }
  89. function setPara_default()
  90. {
  91.    trace("     ------ setPara_default -----");
  92.    firstBall = undefined;
  93.    last_ball = undefined;
  94.    gameOver = false;
  95.    m_lock = false;
  96.    boom_bool = false;
  97.    forward_bool = true;
  98.    forward_num = 0;
  99.    dir_bool = false;
  100.    dir_num = 0;
  101.    dir_num_total = 500;
  102.    boom_bool = false;
  103.    boom_lock_times = 0;
  104.    tgt_num = 0;
  105.    tgt_depth = 100;
  106.    b_depth = 1000;
  107.    balls_num = 0;
  108.    remove_arr_array = new Array();
  109.    break_array = new Array();
  110.    remove_num = 0;
  111.    last_pos = 0;
  112.    i = 0;
  113.    while(i < xNum)
  114.    {
  115.       area[i] = new Array();
  116.       j = 0;
  117.       while(j < yNum)
  118.       {
  119.          area[i][j] = new Object();
  120.          area[i][j].tgt_ball = new Array();
  121.          j++;
  122.       }
  123.       i++;
  124.    }
  125.    myGrid = new Grid(grid_width,xNum,yNum,area);
  126. }
  127. function initShoot()
  128. {
  129.    center_mc._x = center_bg._x;
  130.    center_mc._y = center_bg._y;
  131.    center_bg.move_btn._visible = false;
  132.    shoot_btn.useHandCursor = false;
  133.    center_mc.onMouseMove = function()
  134.    {
  135.       if(!game_pause)
  136.       {
  137.          center_rotation();
  138.          updateAfterEvent();
  139.       }
  140.    };
  141.    shoot_btn.onPress = function()
  142.    {
  143.       if(!game_pause)
  144.       {
  145.          if(ball != undefined)
  146.          {
  147.             maxcomboTE = 0;
  148.             ballShoot();
  149.          }
  150.          else if(_root._currentframe > 15 and _root.gameOver == false)
  151.          {
  152.             trace("crtNewBall");
  153.             crtNewBall();
  154.          }
  155.       }
  156.    };
  157. }
  158. function clearAll()
  159. {
  160.    trace("     ----------clear All---------");
  161.    clearBall();
  162.    clearTgtBall();
  163. }
  164. function clearBall()
  165. {
  166.    delete now_type_tmp_arr;
  167.    delete shoot_listener_mc.onEnterFrame;
  168.    ball.holder.removeMovieClip();
  169.    delete ball;
  170. }
  171. function clearDraw()
  172. {
  173.    line.clear();
  174.    line2.clear();
  175.    dir_mc.clear();
  176. }
  177. function show_mainMc(bool)
  178. {
  179.    if(bool)
  180.    {
  181.       center_mc._x = center_bg._x;
  182.       center_mc._y = center_bg._y;
  183.       center_bg.move_btn._visible = false;
  184.    }
  185.    center_mc._visible = bool;
  186.    center_bg._visible = bool;
  187.    mouth_start._visible = bool;
  188.    mouth._visible = bool;
  189. }
  190. function saveToLocal()
  191. {
  192.    trace("Σ┐¥σ¡ÿσê░µ£¼σ£░");
  193.    if(pos_array.length > 1)
  194.    {
  195.       if(road_name != "")
  196.       {
  197.          board_save.road_name = road_name;
  198.       }
  199.       else
  200.       {
  201.          board_save.road_name = "user_" + random(65535);
  202.       }
  203.       closeAllBoard();
  204.       openBoard(board_save);
  205.       Selection.setFocus(board_save.roadName);
  206.       trace("saveToLocal " + board_save);
  207.    }
  208. }
  209. function openBoard(board)
  210. {
  211.    board.swapDepths(100);
  212.    center_bg.move_btn._visible = false;
  213.    road_btn.enabled = false;
  214.    board._visible = true;
  215. }
  216. function closeBoard(board)
  217. {
  218.    topMenu.swapDepths(topMenu.init_depth);
  219.    center_bg.move_btn._visible = true;
  220.    road_btn.enabled = true;
  221.    board._visible = false;
  222.    board._x = board.initx;
  223.    board._y = board.inity;
  224.    board.myicon.gotoAndStop(1);
  225. }
  226. function closeAllBoard()
  227. {
  228.    closeBoard(board_save);
  229.    closeBoard(board_open);
  230.    closeBoard(board_setup);
  231. }
  232. function levelRun(levleTitle, level_num, bg_snd)
  233. {
  234.    trace(" meiliyou ");
  235.    for(var _loc2_ in _root.tgt_mcs)
  236.    {
  237.       trace(" tgt_mcs --------  = " + tgt_mcs[_loc2_]);
  238.    }
  239.    old_levelNum = levelNum;
  240.    levelNum = level_num;
  241.    setLevel(levleTitle);
  242.    goal_total_mc.getNum(goal_total,goal_total_mc.obj,"mynum",12);
  243.    life_mc.getNum(life,life_mc.obj,"mynum",12);
  244.    setTgt_bar();
  245.    center_bg._x = pos.x;
  246.    center_bg._y = pos.y;
  247.    pos_array = new Array();
  248.    pos_array = set_pos(x_array,y_array,r_array);
  249.    setPara_default();
  250.    initLevelPara(para);
  251.    readyPlay();
  252.    show_mainMc(true);
  253.    m_lock = false;
  254.    rndPlay_bg_snd();
  255. }
  256. function openWin(win)
  257. {
  258.    win.swapDepths(100);
  259.    win._visible = true;
  260.    noclick_btn._visible = true;
  261. }
  262. function closeWin(win)
  263. {
  264.    trace("closeWin " + win);
  265.    win._visible = false;
  266.    win._x = win.initx;
  267.    win._y = win.inity;
  268.    win.myicon.gotoAndStop(1);
  269.    noclick_btn._visible = false;
  270. }
  271. var KEYtemp = false;
  272. clearLine = function()
  273. {
  274.    line.cacheAsBitmap = false;
  275.    line1.cacheAsBitmap = false;
  276.    line2.cacheAsBitmap = false;
  277.    line.clear();
  278.    line2.clear();
  279.    crtLine = false;
  280. };
  281. clearTgtBall = function()
  282. {
  283.    delete move_listener_mc.onEnterFrame;
  284.    for(name in tgt_mcs)
  285.    {
  286.       if(name != _root.EndBall._name)
  287.       {
  288.          if(typeof tgt_mcs[name] == "movieclip")
  289.          {
  290.             tgt_mcs[name].removeMovieClip();
  291.          }
  292.       }
  293.    }
  294. };
  295. setFlower = function()
  296. {
  297.    for(name in tgt_mcs)
  298.    {
  299.       if(typeof tgt_mcs[name] == "movieclip")
  300.       {
  301.          tgt_mcs[name].flower.roll_mc._visible = flower_show_bool;
  302.          tgt_mcs[name].colors = new Color(tgt_mcs[name].flower.roll_mc);
  303.          tgt_mcs[name].colors.setRGB(flower_array[tgt_mcs[name].type - 1]);
  304.       }
  305.    }
  306. };
  307.